﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace paipai
{
    public partial class ETicket : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            #region   session check & init
            if (!IsPostBack)
            {
                if (Session["UserID"] != null)
                {
                    ViewState.Add("UserID", Session["UserID"]);
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }
            }
            #endregion
        }

        protected void ImageButton_Submit_Click(object sender, ImageClickEventArgs e)
        {
            var cQuestion = Bll.CQuestionManage.CreateQuestion();

            cQuestion.ID = Guid.NewGuid().ToString();
            //cQuestion.userID = ViewState["UserID"].ToString();
            cQuestion.questionTime = System.DateTime.Now;
            cQuestion.questionType = DropDownList_qType.Text;
            cQuestion.questionTitle = TextBox_qTitle.Text.Trim();
            cQuestion.questionContent = TextBox_qContent.Text.Trim();

            if(Bll.CQuestionManage.Save(cQuestion) == null)
            {
                // insert error
            }
            else
            {
                TextBox_qTitle.Text = null;
                TextBox_qContent.Text = null;
            }
        }
    }
}
